FROM registry.cn-beijing.aliyuncs.com/leyouyou/centos7-jdk8

ENV APP_NAME lyy-cloud-server
RUN adduser -create-home --no-log-init --shell /bin/bash admin
USER admin
RUN echo "java -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m -Xms512m -Xmx512m -Xmn256m -Xss256k -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -jar /home/admin/$APP_NAME/$APP_NAME-0.0.1.jar">>/home/admin/start.sh

RUN chmod +x /home/admin/start.sh

RUN mkdir -p /home/admin/logs/
RUN chmod -R 777 /home/admin/logs/

# copy 程序代码到容器的/src 下
ADD target/$APP_NAME-0.0.1-SNAPSHOT.jar /home/admin/$APP_NAME/$APP_NAME-0.0.1.jar
VOLUME /home/admin/logs/ /home/admin/logs/

WORKDIR /home/admin/

CMD ["sh","/home/admin/start.sh"]